home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8738 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  54 lines

  1. Newsgroups: comp.lang.ada,comp.lang.c++
  2. Path: news.bton.ac.uk!je
  3. From: je@bton.ac.uk (John English)
  4. Subject: Re: on OO differnces between Ada95 and C++
  5. Message-ID: <DnDuA4.8GC@bton.ac.uk>
  6. Followup-To: comp.lang.ada,comp.lang.c++
  7. Organization: University of Brighton, UK
  8. X-Newsreader: TIN [version 1.2 PL2]
  9. References: <4gbq7q$g08@qualcomm.com> <Dn4J2F.uI@bton.ac.uk> <4gh204$l7n@qualcomm.com>
  10. Date: Mon, 26 Feb 1996 12:20:27 GMT
  11.  
  12. Nasser Abbasi (nabbasi@qualcomm.com) wrote:
  13. : In article <Dn4J2F.uI@bton.ac.uk>, je@bton.ac.uk (John English) says:
  14. : >If the spec of Saving_Account has "with Account" at the beginning,
  15. : >"with Saving_Account" will imply "with Account". 
  16.  
  17. : I do not think this is true. That is the main reason I asked the 
  18. : question in the first place. (I did not like having to "with" 
  19. : a package that was allready with'ed by a package I am "withing" ).
  20.  
  21. Hmm.  I've been having another look at the visibility rules in the LRM and,
  22. as usual, they've made my head go round and round :-)
  23.  
  24. Certainly GNAT allows you to reference Account.X if you have "with
  25. Saving_Account" (but I'm all too aware that GNAT /= Ada95 :-), although
  26. the same is not true for "use" clauses ("use Saving_Account" does not
  27. imply "use Account").  Remember that I'm talking about *with clauses in
  28. package specifications* and not use clauses *or* package bodies (in case
  29. there is any confusion about this).
  30.  
  31. : If what you say was the case, then types defined in package "A"
  32. : will be seen by clients to a package "B" where "B" has with'ed A. But
  33. : it is not so. Clients of "B" must also 'with' "A" to see types defined
  34. : in "A" even though "B: has allready  with'ed "A".
  35.  
  36. If you're right this would be a real pain.  Clients of a package would have
  37. to know (recursively) what other packages the spec(s) reference; if the
  38. spec for X "withs" a package Y so it can use type Y.T as a procedure
  39. parameter then you wouldn't be able to use X without Y (i.e. "with X"
  40. on its own would be useless; you'd have to have "with X, Y" and probably
  41. other things as well if Y has any "with" clauses in its specification.
  42.  
  43. This is such a horrible concept that I'm inclined to believe GNAT, but
  44. if anyone who can understand all the subleties of the visibility rules
  45. can give us all a definitive explanation in words of sufficiently few
  46. syllables that Bears of Very Little Brain like me can understand, I for
  47. one would be profoundly grateful.
  48.  
  49. -- 
  50. ----------------------------------------------------------------------------
  51. John English <je@brighton.ac.uk>, Dept. of Computing, University of Brighton
  52.   "Disks are divided into sex and tractors..."
  53. ----------------------------------------------------------------------------
  54.